<?php

namespace Hr\OnlineBundle\Controller;

// use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Hr\OnlineBundle\Controller\GenericController;

class PageController extends GenericController
{
    public function indexAction()
    {
		parent::init();

		/*
		$securityContext = $this->container->get('security.context');
		if( $securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED') ){

			echo 'test';
			// authenticated REMEMBERED, FULLY will imply REMEMBERED (NON anonymous)
		}
		*/

		$em = $this->getDoctrine()->getManager();

        $positions = $em->getRepository('HrOnlineBundle:Position')->getLatestPositions();

        return $this->render('HrOnlineBundle:Page:index.html.twig', array(
            'positions' => $positions
		));

    }

	public function sidebarAction()
	{
		$router = $this->get("router");

		$brandName = $this->container->getParameter('hr_online.brand_name'); 

		return $this->render('HrOnlineBundle:Page:sidebar.html.twig', array(
			'brandName'=>$brandName
		));
	}


}